   1              		.syntax unified
   2              		.cpu cortex-m3
   3              		.fpu softvfp
   4              		.eabi_attribute 20, 1
   5              		.eabi_attribute 21, 1
   6              		.eabi_attribute 23, 3
   7              		.eabi_attribute 24, 1
   8              		.eabi_attribute 25, 1
   9              		.eabi_attribute 26, 1
  10              		.eabi_attribute 30, 4
  11              		.eabi_attribute 34, 1
  12              		.eabi_attribute 18, 4
  13              		.thumb
  14              		.syntax unified
  15              		.file	"iap.c"
  16              		.text
  17              	.Ltext0:
  18              		.cfi_sections	.debug_frame
  19              		.section	.text.iap_Call,"ax",%progbits
  20              		.align	1
  21              		.thumb
  22              		.thumb_func
  24              	iap_Call:
  25              	.LFB14:
  26              		.file 1 "uc_libc_dev/_arch/arm_lpc/flash/iap.c"
   1:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //
   2:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  $Id: iap.c 188 2008-10-19 14:36:39Z jcw $
   3:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  $Revision: 188 $
   4:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  $Author: jcw $
   5:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  $Date: 2008-10-19 10:36:39 -0400 (Sun, 19 Oct 2008) $
   6:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  $HeadURL: http://tinymicros.com/svn_public/arm/lpc2148_demo/trunk/iap/iap.c $
   7:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //
   8:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #include "iap.h"
   9:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #include "vic.h"
  10:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #include <string.h>
  11:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
  12:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #if (IAP_USE_DEBUG == pdON)
  13:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #include "stdio_uc.h"
  14:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #endif
  15:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
  16:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static void iap_Call (void);
  17:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static u32 iapCommands [5];
  18:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static u32 iapResults [3];
  19:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #define iap_entry(a,b) ((void(*)())(IAP_LOCATION))(a,b)
  20:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
  21:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // VARIÁVEIS DECLARADAS NO LINKSCRIPT
  22:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //extern u32 _ivector;
  23:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //extern u32 _evector;
  24:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** extern u32 _itext;
  25:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** extern u32 _etext;
  26:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //static u32 init_of_vector = (u32)&_ivector;
  27:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //static u32 end_of_vector = (u32)&_evector;
  28:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static u32 init_of_text = (u32)&_itext;
  29:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static u32 end_of_text = (u32)&_etext;
  30:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
  31:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
  32:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #if defined(LPC2468)
  33:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** flashSectorToAddress_t flashSectorToAddress [] =  {
  34:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Página 809 do datasheet 681
  35:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00000000, 4096 },   // 0
  36:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00001000, 4096 },   // 1
  37:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00002000, 4096 },   // 2
  38:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00003000, 4096 },   // 3
  39:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00004000, 4096 },   // 4
  40:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00005000, 4096 },   // 5
  41:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00006000, 4096 },   // 6
  42:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00007000, 4096 },   // 7
  43:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00008000, 32768 },  // 8
  44:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00010000, 32768 },  // 9
  45:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00018000, 32768 },  // 10
  46:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00020000, 32768 },  // 11
  47:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00028000, 32768 },  // 12
  48:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00030000, 32768 },  // 13
  49:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00038000, 32768 },  // 14
  50:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00040000, 32768 },  // 15
  51:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00048000, 32768 },  // 16
  52:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00050000, 32768 },  // 17
  53:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00058000, 32768 },  // 18
  54:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00060000, 32768 },  // 19
  55:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00068000, 32768 },  // 20
  56:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00070000, 32768 },  // 21
  57:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00078000, 4096 },   // 22
  58:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00079000, 4096 },   // 23
  59:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0007a000, 4096 },   // 24
  60:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0007b000, 4096 },   // 25
  61:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0007c000, 4096 },   // 26
  62:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0007d000, 4096 },   // 27
  63:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** };
  64:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #elif defined(LPC1788)
  65:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Página 809 do datasheet
  66:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Flash de 512KB
  67:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** flashSectorToAddress_t flashSectorToAddress [] =  {
  68:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00000000, 4096 },   // 0
  69:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00001000, 4096 },   // 1
  70:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00002000, 4096 },   // 2
  71:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00003000, 4096 },   // 3
  72:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00004000, 4096 },   // 4
  73:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00005000, 4096 },   // 5
  74:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00006000, 4096 },   // 6
  75:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00007000, 4096 },   // 7
  76:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00008000, 4096 },   // 8
  77:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00009000, 4096 },   // 9
  78:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000a000, 4096 },   // 10
  79:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000b000, 4096 },   // 11
  80:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000c000, 4096 },   // 12
  81:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000d000, 4096 },   // 13
  82:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000e000, 4096 },   // 14
  83:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000f000, 4096 },   // 15
  84:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00010000, 32768 },  // 16
  85:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00018000, 32768 },  // 17
  86:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00020000, 32768 },  // 18
  87:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00028000, 32768 },  // 19
  88:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00030000, 32768 },  // 20
  89:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00038000, 32768 },  // 21
  90:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00040000, 32768 },  // 22
  91:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00048000, 32768 },  // 23
  92:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00050000, 32768 },  // 24
  93:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00058000, 32768 },  // 25
  94:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00060000, 32768 },  // 26
  95:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00068000, 32768 },  // 27
  96:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00070000, 32768 },  // 28
  97:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00078000, 32768 },  // 29
  98:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** };
  99:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #elif defined(LPC1752)
 100:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Página 620 do datasheet
 101:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Flash de 64KB
 102:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** flashSectorToAddress_t flashSectorToAddress [] =  {
 103:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00000000, 4096 },   // 0
 104:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00001000, 4096 },   // 1
 105:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00002000, 4096 },   // 2
 106:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00003000, 4096 },   // 3
 107:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00004000, 4096 },   // 4
 108:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00005000, 4096 },   // 5
 109:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00006000, 4096 },   // 6
 110:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00007000, 4096 },   // 7
 111:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00008000, 4096 },   // 8
 112:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00009000, 4096 },   // 9
 113:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000a000, 4096 },   // 10
 114:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000b000, 4096 },   // 11
 115:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000c000, 4096 },   // 12
 116:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000d000, 4096 },   // 13
 117:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000e000, 4096 },   // 14
 118:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x0000f000, 4096 },   // 15
 119:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** };
 120:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #elif defined(LPC1751)
 121:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Página 620 do datasheet
 122:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Flash de 32KB
 123:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** flashSectorToAddress_t flashSectorToAddress [] =  {
 124:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00000000, 4096 },   // 0
 125:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00001000, 4096 },   // 1
 126:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00002000, 4096 },   // 2
 127:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00003000, 4096 },   // 3
 128:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00004000, 4096 },   // 4
 129:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00005000, 4096 },   // 5
 130:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00006000, 4096 },   // 6
 131:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   { 0x00007000, 4096 },   // 7
 132:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** };
 133:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #else
 134:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****    #error Este dispositivo não foi implementado IAP
 135:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #endif
 136:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 137:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 138:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #if defined(arm7tdmi)
 139:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static u32 _cpsr;
 140:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static void iap_irqDisable(void);
 141:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static void iap_irqEnable(void);
 142:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 143:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static void iap_irqDisable(void) {
 144:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	_cpsr = ints_Disable();
 145:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 146:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 147:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static void iap_irqEnable(void) {
 148:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	ints_Restore(_cpsr);
 149:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 150:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #endif
 151:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 152:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #if defined(cortexm3)
 153:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #define iap_irqDisable 	irq_Disable
 154:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #define iap_irqEnable 	irq_Enable
 155:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** #endif
 156:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 157:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 158:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 159:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // COMANDOS USUAIS NAS APLICAÇÕES
 160:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 161:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 162:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 163:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 164:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 165:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Comando para apagar os setores da FLASH
 166:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	startingSector: Setor incial para o apagamento
 167:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				endingSector:	Setor final para o apagamento
 168:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso os setores foram apagados com sucesso
 169:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_PARAM_INVALID: Caso o endereço final é menor que o endereço inicial
 170:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_BUSY: Caso a memória FLASH está ocupada
 171:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso um dos setores (inicil ou final) for inválido
 172:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_NOT_PREPARED: Caso se os setores não foram preparados para o apagamento
 173:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 174:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_ClearSectors (u32 startingSector, u32 endingSector) {
 175:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 176:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 177:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if defined(arm7tdmi)
 178:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 _memmap;
 179:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 180:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 181:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 182:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	plog("IAP: clear sector [%u %u]"CMD_TERMINATOR, startingSector, endingSector);
 183:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 184:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 185:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// SE A GRAVAÇÃO FOR NO VETOR DE Exceções, CHAVEAR O VETOR PARA FLASH CASO ESTIVER EM OUTRO LUGAR
 186:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	irq_Disable();
 187:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 188:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if defined(arm7tdmi)
 189:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (startingSector == 0)  {
 190:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		_memmap = MEMMAP;
 191:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		MEMMAP = MEMMAP_FLASH;
 192:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#if (IAP_USE_DEBUG == pdON)
 193:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		plog("FLASH 0"CMD_TERMINATOR);
 194:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#endif
 195:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	}
 196:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 197:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 198:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// PREPAR SETORES PARA O APAGAMENTO
 199:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((result = iap_PrepareSectors(startingSector, endingSector) ) !=pdPASS)
 200:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		goto end_iap_ClearSectors;
 201:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 202:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 203:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	result = iap_EraseSectors(startingSector, endingSector);
 204:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 205:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	end_iap_ClearSectors:
 206:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 207:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if defined(arm7tdmi)
 208:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (startingSector == 0)  {
 209:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		MEMMAP = _memmap;
 210:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#if (IAP_USE_DEBUG == pdON)
 211:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		plog("FLASH 0"CMD_TERMINATOR);
 212:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#endif
 213:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	}
 214:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 215:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 216:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_irqEnable();
 217:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 218:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 219:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (result == pdPASS)
 220:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		plog("IAP: clear ok [%u %u]"CMD_TERMINATOR, startingSector, endingSector);
 221:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else  plog("IAP: clear fail[%d] [%u %u]"CMD_TERMINATOR, result, startingSector, endingSector);
 222:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 223:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 224:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return result;
 225:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 226:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 227:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 228:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Escreve um buffer de dados na memória FLASH do ARM
 229:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 230:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ATENÇÃO: 	É PRECISO QUE OS SETORES ESTEJAM APAGADOS com iap_ClearSectors()
 231:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 232:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	address: Endereço da FLASH para ser gravado. DEVE SER DENTRO DOS LIMITES DE 256 BYTE
 233:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				buffer: Ponteiro do buffer de dados a ser gravado na FLASH
 234:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				bufferLen: O tamanho do buffer deve ser de 256, 512, 1024 OU 4096 bytes
 235:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso a gravação do conetúdo da RAM foi feito com sucesso na FLASH
 236:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SIZE_INVALID: O tamanho do buffer de gravação é inválido. Deve ser 256, 512, 1024 ou 4
 237:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_BUSY: Caso a memória FLASH está ocupada
 238:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso não foi encontrado o setor do respectivo endereço da FLASH
 239:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_NOT_PREPARED: O setor a ser gravado não foi preparado para gravação
 240:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR:
 241:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR:
 242:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR_NOT_MAPPED:
 243:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR_NOT_MAPPED:
 244:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_COUNT: Caso o contador de bytes não for multiplo de 4
 245:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_COMPARE: Os dados gravados no FLASH não foi conferiru com o buffer de dados
 246:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 247:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_WriteSectors (u32 address, u8 *buffer, u16 bufferLen) {
 248:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 249:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 sector;
 250:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if defined(arm7tdmi)
 251:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 _memmap;
 252:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 253:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 254:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	//if (!iap_IsSafeSector (startingSector) || !iap_IsSafeSector (endingSector))
 255:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		//return -1;
 256:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 257:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ( (bufferLen!=256) && (bufferLen!=512) && (bufferLen!=1024) && (bufferLen!=4096) )
 258:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SIZE_INVALID;
 259:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 260:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// Buscar o setor de acordo com endereço a ser gravado
 261:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// 		Cada gravação pelo iap_WriteSectors será sempre no mesmo setor da FLASH
 262:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((result = iap_AddressToSector(address, &sector)) != pdPASS)
 263:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return result;
 264:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 265:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 266:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	plog("IAP: write flash addr 0x%x sector %u"CMD_TERMINATOR, address, sector);
 267:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 268:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 269:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_irqDisable();
 270:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 271:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if defined(arm7tdmi)
 272:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// SE A GRAVAÇÃO FOR NO VETOR DE Exceções, CHAVEAR O VETOR PARA FLASH CASO ESTIVER EM OUTRO LUGAR
 273:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (sector == 0)  {
 274:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		_memmap = MEMMAP;
 275:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		MEMMAP = MEMMAP_FLASH;
 276:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#if (IAP_USE_DEBUG == pdON)
 277:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		plog("IAP: change MEMMAP [%u]"CMD_TERMINATOR, MEMMAP);
 278:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#endif
 279:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	}
 280:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 281:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 282:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// PREPARAR O SETOR PARA GRAVAÇÃO
 283:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((result = iap_PrepareSectors (sector, sector)) != pdPASS)
 284:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		goto end_iap_WriteSectors;
 285:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 286:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 287:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// COPIAR O CONTEÚDO DA RAM (buffer) PARA O FLASH
 288:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((result = iap_CopyRAMtoFLASH(address, buffer, bufferLen)) != pdPASS)
 289:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		goto end_iap_WriteSectors;
 290:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 291:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 292:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	plog("IAP: write flash addr 0x%x [%u] len %u"CMD_TERMINATOR, address, sector, bufferLen);
 293:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 294:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 295:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// Comparar o conteúdo da ram (buffer) com a flash.
 296:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	//	Para verificar se o conteúdo foi gravado corretamente
 297:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	result = iap_Compare(address, buffer, bufferLen);
 298:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 299:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	end_iap_WriteSectors:
 300:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 301:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if defined(arm7tdmi)
 302:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (sector == 0)
 303:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		MEMMAP = _memmap;
 304:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 305:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 306:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_irqEnable();
 307:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 308:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 309:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	plog("IAP: write ok"CMD_TERMINATOR);
 310:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 311:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 312:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return result;
 313:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 314:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 315:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 316:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição: 	Preenche os setores com um determinado valor
 317:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 318:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ATENÇÃO: 	É PRECISO QUE OS SETORES ESTEJAM APAGADOS com iap_ClearSectors
 319:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 320:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	startingSector: Setor inicial para preenchimento
 321:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				endingSector: Setor final para preenchimento
 322:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				byte:  Valor para ser preenchido nos setores
 323:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso o preenchimento foi feito com sucesso
 324:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_PARAM_INVALID: Caso o endereço final é menor que o endereço inicial
 325:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_BUSY: Caso a memória FLASH está ocupada
 326:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso um dos setores (inicil ou final) for inválido
 327:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_NOT_PREPARED: Caso se os setores não foram preparados para o apagamento
 328:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR:
 329:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR:
 330:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR_NOT_MAPPED:
 331:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR_NOT_MAPPED:
 332:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_COMPARE: Caso as duas regiões não contém os mesmos dados
 333:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_COUNT: Caso o contador de bytes não for multiplo de 4
 334:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 335:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_FillSectors (u32 startingSector, u32 endingSector, u8 byte) {
 336:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 337:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 sector;
 338:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u8 buffer [256];
 339:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if defined(arm7tdmi)
 340:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 _memmap;
 341:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 342:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 343:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	//if (!iap_IsSafeSector (startingSector) || !iap_IsSafeSector (endingSector))
 344:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		//return -1;
 345:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 346:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (endingSector < startingSector)
 347:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_PARAM_INVALID;
 348:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 349:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	memset (buffer, byte, sizeof(buffer));
 350:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	result = pdPASS;
 351:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_irqDisable();
 352:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 353:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	for (sector = startingSector; sector <= endingSector; sector++) {
 354:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		u16 i;
 355:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		u32 address;
 356:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		u32 sectorSize;
 357:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 358:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#if defined(arm7tdmi)
 359:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		// SE A GRAVAÇÃO FOR NO VETOR DE Exceções, CHAVEAR O VETOR PARA FLASH CASO ESTIVER EM OUTRO LUGAR
 360:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		if (sector == 0)  {
 361:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			_memmap = MEMMAP;
 362:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			MEMMAP = MEMMAP_FLASH;
 363:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			#if (IAP_USE_DEBUG == pdON)
 364:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			plog("IAP: write flash [%u]"CMD_TERMINATOR, MEMMAP);
 365:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			#endif
 366:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		}
 367:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#endif
 368:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 369:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		if ((result = iap_SectorToAddress (sector, &address, &sectorSize)) != pdPASS)
 370:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			goto end_iap_FillSectors;
 371:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 372:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		// FAÇO PARA OS TODOS OS BYTES DO SETOR
 373:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		for (i = 0; i < sectorSize; i += sizeof(buffer)) {
 374:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 375:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			// PREPARAR O SETOR PARA GRAVAÇÃO
 376:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			if ((result = iap_PrepareSectors (sector, sector)) != pdPASS)
 377:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 				break;
 378:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 379:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			// COPIAR O CONTEÚDO DA RAM (buffer) PARA O FLASH
 380:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			if ((result = iap_CopyRAMtoFLASH (address + i, buffer, sizeof(buffer))) != pdPASS)
 381:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 				break;
 382:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 383:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			// COMPARAR O CONTEÚDO DA RAM (buffer) COM A FLAHS.
 384:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			//	Para verificar se o conteúdo foi gravado corretamente
 385:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			if ((result = iap_Compare (address + i, buffer, sizeof (buffer))) != pdPASS)
 386:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 				break;
 387:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		}
 388:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 389:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		end_iap_FillSectors:
 390:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 391:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#if defined(arm7tdmi)
 392:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		if (sector == 0)  {
 393:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			MEMMAP = _memmap;
 394:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			#if (IAP_USE_DEBUG == pdON)
 395:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			plog("IAP: write ok [%u]"CMD_TERMINATOR, MEMMAP);
 396:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			#endif
 397:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		}
 398:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		#endif
 399:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 400:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		if (result != pdPASS)
 401:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			break;
 402:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	}
 403:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 404:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_irqEnable();
 405:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return result;
 406:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 407:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 408:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 409:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // COMANDOS IAP
 410:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 411:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 412:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 413:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Prepara os setores para apagamento ou gravação
 414:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	startingSector: Setor inicial para preparação
 415:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				endingSector: Setor final para preparação
 416:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso a preparação foi feita com sucesso
 417:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_BUSY: Caso a memória FLASH está ocupada
 418:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso um dos setores (inicil ou final) for inválido
 419:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 420:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_PrepareSectors (u32 startingSector, u32 endingSector) {
 421:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //	  if (!iapIsSafeSector (startingSector) || !iapIsSafeSector (endingSector))
 422:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	//    return -1;
 423:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 424:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_PREPARE;
 425:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = startingSector;
 426:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = endingSector;
 427:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 428:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 429:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 430:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	plog("IAP: prepare sector [%u %u]"CMD_TERMINATOR, startingSector, endingSector);
 431:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 432:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 433:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (iapResults [0] == IAP_RESULT_BUSY)
 434:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_BUSY;
 435:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_INVALID_SECTOR)
 436:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_SECTOR_INVALID;
 437:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else
 438:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return pdPASS;
 439:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 440:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 441:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 442:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Grava um buffer de dados na memória FLASH do ARM
 443:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 444:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ATENÇÃO: 	É PRECISO QUE OS SETORES ESTEJAM APAGADOS E PREPARADOS
 445:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 446:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	address: Endereço da FLASH para ser agravado. DEVE SER DENTRO DOS LIMITES DE 256 BYT
 447:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				buffer: Ponteiro do buffer de dados a ser gravado na FLASH
 448:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				bufferLen: O tamanho do buffer. DEVE SER DE 256, 512, 1024 OU 4096 BYTES
 449:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso a gravação do conetúdo da RAM foi feito com sucesso na FLASH
 450:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_NOT_PREPARED;
 451:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_BUSY;
 452:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR;
 453:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR;
 454:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR_NOT_MAPPED;
 455:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR_NOT_MAPPED;
 456:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_COUNT;
 457:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 458:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  IAP_CMD_COPYRAMTOFLASH can span multiple sectors (2, at any rate, since bufferLen
 459:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  must be 256, 512, 1024 or 4096, and the smallest sectors are 4096 bytes).  Although
 460:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  more than 2 sectors can be prepared for writing, it's useless to do so, since
 461:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  after each IAP_CMD_COPYRAMTOFLASH, the sectors are re-locked.
 462:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_CopyRAMtoFLASH (u32 address, u8 *buffer, u16 bufferLen) {
 463:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_COPYRAMTOFLASH;
 464:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = address;
 465:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = (u32)buffer;
 466:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [3] = (u32)bufferLen;
 467:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [4] = CCLK/1000;
 468:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 469:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 470:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (iapResults [0] == IAP_RESULT_BUSY)
 471:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_BUSY;
 472:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SECTOR_NOT_PREPARED)
 473:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_NOT_PREPARED;
 474:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_ERROR)
 475:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR;
 476:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_ERROR)
 477:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR;
 478:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_NOT_MAPPED)
 479:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR_NOT_MAPPED;
 480:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_NOT_MAPPED)
 481:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR_NOT_MAPPED;
 482:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_COUNT_ERROR)
 483:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_COUNT;
 484:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else
 485:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return pdPASS;
 486:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 487:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 488:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 489:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 490:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Comando para apagar os setores da FLASH
 491:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	startingSector: Setor incial para o apagamento
 492:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				endingSector:	Setor final para o apagamento
 493:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso os setores foram apagados com sucesso
 494:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_PARAM_INVALID: Caso o endereço final é menor que o endereço inicial
 495:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_BUSY: Caso a memória FLASH está ocupada
 496:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso um dos setores (inicil ou final) for inválido
 497:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_NOT_PREPARED: Caso se os setores não foram preparados para o apagamento
 498:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 499:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_EraseSectors (u32 startingSector, u32 endingSector) {
 500:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 501:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	//if (!iap_IsSafeSector (startingSector) || !iap_IsSafeSector (endingSector))
 502:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		//return -1;
 503:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 504:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (endingSector < startingSector)
 505:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_PARAM_INVALID;
 506:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 507:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// APAGAR SETORES
 508:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_ERASE;
 509:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = startingSector;
 510:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = endingSector;
 511:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [3] = CCLK/1000;
 512:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 513:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 514:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 515:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	plog("IAP: erase sector [%u %u]"CMD_TERMINATOR, startingSector, endingSector);
 516:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 517:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 518:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (iapResults [0] == IAP_RESULT_BUSY)
 519:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_BUSY;
 520:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SECTOR_NOT_PREPARED)
 521:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_SECTOR_NOT_PREPARED;
 522:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_INVALID_SECTOR)
 523:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_SECTOR_INVALID;
 524:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else
 525:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return pdPASS;
 526:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 527:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 528:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 529:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Checa se os setores estão em branco
 530:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	startingSectorr: Setor para inicio para análise
 531:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				endingSector: Setor final para análise
 532:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso o setores estão em branco
 533:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_BUSY: Caso a memória FLASH está ocupada
 534:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_NOT_BLANK: Caso o setores contém dados
 535:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso foi acessado um setor inválido
 536:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 537:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_IsSectorsBlank (u32 startingSector, u32 endingSector) {
 538:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_BLANKCHECK;
 539:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = startingSector;
 540:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = endingSector;
 541:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 542:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 543:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (iapResults [0] == IAP_RESULT_BUSY)
 544:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_BUSY;
 545:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SECTOR_NOT_BLANK)
 546:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_NOT_BLANK;
 547:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_INVALID_SECTOR)
 548:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_INVALID;
 549:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else
 550:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return pdPASS;
 551:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 552:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 553:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 554:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 555:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Lê o número de identificação do ARM
 556:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	Nenhum
 557:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna: 	Retorna com ID da ARM
 558:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 559:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** u32 iap_ReadPartID (void) {
 560:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_READPARTID;
 561:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 562:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return iapResults [1];
 563:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 564:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 565:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 566:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição: 	Lê a versão do bootloader do ARM
 567:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	Nenhum
 568:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		Retorna com a versão do bootloader
 569:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 570:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** u32 iap_ReadBootCodeVersion (void) {
 571:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_READBOOTCODEVER;
 572:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 573:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return iapResults [1];
 574:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 575:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 576:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 577:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Faz uma comparação entre a região FLASH com um buffer de dados
 578:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	address: Endereço da FLASH para ser comparado
 579:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				buffer: Ponteiro do buffer de dados a ser comparado com a FLASH
 580:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				bufferLen: O tamanho do buffer. DEVE SER DE 256, 512, 1024 OU 4096 BYTES
 581:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso a comparação foi feita com sucesso e as duas regiões contém os mesmos dad
 582:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_COMPARE: Caso as duas regiões não contém os mesmos dados
 583:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_COUNT: Caso o contador de bytes não for multiplo de 4
 584:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR:
 585:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR;
 586:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_SRC_ADDR_NOT_MAPPED;
 587:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // 				errIAP_DST_ADDR_NOT_MAPPED;
 588:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 589:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_Compare (u32 address, u8 *buffer, u16 bufferLen) {
 590:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_COMPARE;
 591:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = address;
 592:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = (u32) buffer;
 593:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [3] = bufferLen;
 594:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 595:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 596:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (iapResults [0] == IAP_RESULT_COMPARE_ERROR)
 597:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_COMPARE;
 598:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_COUNT_ERROR)
 599:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_COUNT;
 600:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_ERROR)
 601:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR;
 602:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_ERROR)
 603:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR;
 604:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_NOT_MAPPED)
 605:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR_NOT_MAPPED;
 606:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_NOT_MAPPED)
 607:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR_NOT_MAPPED;
 608:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else
 609:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return pdPASS;
 610:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 611:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 612:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 613:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 614:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 615:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // COMANDOS AUXILIARES
 616:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 617:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //#################################################################################################
 618:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** /*
 619:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  Returns a safe sector number or -1 if none available
 620:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_FindSafeSector (void) {
 621:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	unsigned int i;
 622:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 623:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	for (i = 0; i < arrsizeof (flashSectorToAddress); i++)
 624:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		if (iap_IsSafeSector (i))
 625:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			return i;
 626:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 627:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapErrno = IAP_RESULT_X_NOSAFEREGIONAVAIL;
 628:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return -1;
 629:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 630:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 631:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //  1 == address in safe region, 0 if not
 632:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_IsSafeAddress (u32 address) {
 633:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int eotSector;
 634:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int addressSector;
 635:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 636:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((eotSector = iap_AddressToSector (end_of_text)) == -1)
 637:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return 0;
 638:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((addressSector = iap_AddressToSector (address)) == -1)
 639:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return 0;
 640:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 641:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if (addressSector <= eotSector) {
 642:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		iapErrno = IAP_RESULT_X_NOTSAFEREGION;
 643:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return 0;
 644:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	}
 645:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 646:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return 1;
 647:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 648:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** */
 649:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 650:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 651:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Checa se um determinado setor pertece ao firmware
 652:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	Sector: Setor a ser consultado
 653:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso o setor não pertence ao firmware
 654:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_NO_SAFE_REGION: Caso o setor pertence ao firmware
 655:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso não foi encontrado o setor do respectivo endereço
 656:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 657:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_IsSafeSector (u32 sector) {
 658:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 659:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 cmpSectorInit;
 660:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 cmpSectorEnd;
 661:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 662:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	// CAPTURO ENDEREÇOS INICIAL E FINAL DO FIRMWARE NA FLASH
 663:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ( (result = iap_AddressToSector (init_of_text, &cmpSectorInit)) != pdPASS)
 664:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return result;
 665:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 666:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ( (result = iap_AddressToSector (end_of_text, &cmpSectorEnd)) != pdPASS)
 667:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return result;
 668:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 669:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ( (sector >= cmpSectorInit) && (sector <= cmpSectorEnd) )
 670:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_NO_SAFE_REGION;
 671:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 672:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return pdPASS;
 673:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 674:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 675:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 676:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Checa se o setor existe no ARM
 677:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	Numero do setor a ser consultado
 678:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso o setor exista
 679:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso o setor não exista
 680:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 681:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_IsValidSector (u32 sector) {
 682:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((sector >= (u32) arrsizeof (flashSectorToAddress))) {
 683:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_INVALID;
 684:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	}
 685:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 686:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return pdPASS;
 687:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 688:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 689:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 690:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Traz a que setor pertence o endereço da FLASH
 691:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	Address: Endereço da FLASH para consulta
 692:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				sector: Ponteiro do setor para retorno
 693:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso foi encontrado o setor
 694:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso não foi encontrado o setor do respectivo endereço
 695:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 696:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_AddressToSector (u32 address, u32 *sector) {
 697:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 i;
 698:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 699:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	for (i = 0; i < (u32) arrsizeof (flashSectorToAddress); i++)
 700:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	if (address < (flashSectorToAddress [i].address + flashSectorToAddress [i].sizeInBytes)) {
 701:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     		*sector = i;
 702:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			#if (IAP_USE_DEBUG == pdON)
 703:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     		plog("IAP: addr2sector [0x%x %u]"CMD_TERMINATOR, address, *sector);
 704:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			#endif
 705:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 706:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     		return pdPASS;
 707:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	}
 708:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 709:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	return errIAP_SECTOR_INVALID;
 710:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 711:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 712:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 713:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Traz o endereço e o tamanho do setor de um determinado setor
 714:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	sectorNumber: Setor a ser consultado
 715:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				address: Ponetiro para retorno do endereço do setor
 716:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				sectorSize: Ponteiro para o retorno do tamanho do setor
 717:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna:		pdPASS: Caso foi encontrado o setor
 718:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //				errIAP_SECTOR_INVALID: Caso não foi encontrado o endereço do respectivo setor
 719:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 720:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** int iap_SectorToAddress (u32 sectorNumber, u32 *address, u32 *sectorSize) {
 721:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	if (sectorNumber >= (u32) arrsizeof (flashSectorToAddress))
 722:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	return errIAP_SECTOR_INVALID;
 723:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 724:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	if (address)
 725:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	*address = flashSectorToAddress [sectorNumber].address;
 726:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	if (sectorSize)
 727:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	*sectorSize = flashSectorToAddress [sectorNumber].sizeInBytes;
 728:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 729:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#if (IAP_USE_DEBUG == pdON)
 730:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	plog("IAP: sector2addr [%u 0x%x %u]"CMD_TERMINATOR, sectorNumber, *address, *sectorSize);
 731:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	#endif
 732:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 733:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	return pdPASS;
 734:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 735:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 736:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 737:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Descrição:	Função de chamada das funções IAP na boot block do ARM
 738:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Parametros:	Nenhum
 739:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // Retorna: 	Nada
 740:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** // ------------------------------------------------------------------------------------------------
 741:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** static void iap_Call (void) {
  27              		.loc 1 741 0
  28              		.cfi_startproc
  29              		@ args = 0, pretend = 0, frame = 0
  30              		@ frame_needed = 0, uses_anonymous_args = 0
  31 0000 08B5     		push	{r3, lr}
  32              	.LCFI0:
  33              		.cfi_def_cfa_offset 8
  34              		.cfi_offset 3, -8
  35              		.cfi_offset 14, -4
 742:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_irqDisable();
  36              		.loc 1 742 0
  37              		.syntax unified
  38              	@ 742 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
  39 0002 72B6     		cpsid i
  40              	@ 0 "" 2
 743:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_entry(iapCommands, iapResults);
  41              		.loc 1 743 0
  42              		.thumb
  43              		.syntax unified
  44 0004 0249     		ldr	r1, .L2
  45 0006 0348     		ldr	r0, .L2+4
  46 0008 034B     		ldr	r3, .L2+8
  47 000a 9847     		blx	r3
  48              	.LVL0:
 744:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_irqEnable();
  49              		.loc 1 744 0
  50              		.syntax unified
  51              	@ 744 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
  52 000c 62B6     		cpsie i
  53              	@ 0 "" 2
  54              		.thumb
  55              		.syntax unified
  56 000e 08BD     		pop	{r3, pc}
  57              	.L3:
  58              		.align	2
  59              	.L2:
  60 0010 00000000 		.word	.LANCHOR0
  61 0014 00000000 		.word	.LANCHOR1
  62 0018 F11FFF1F 		.word	536813553
  63              		.cfi_endproc
  64              	.LFE14:
  66              		.section	.text.iap_PrepareSectors,"ax",%progbits
  67              		.align	1
  68              		.global	iap_PrepareSectors
  69              		.thumb
  70              		.thumb_func
  72              	iap_PrepareSectors:
  73              	.LFB3:
 420:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** //	  if (!iapIsSafeSector (startingSector) || !iapIsSafeSector (endingSector))
  74              		.loc 1 420 0
  75              		.cfi_startproc
  76              		@ args = 0, pretend = 0, frame = 0
  77              		@ frame_needed = 0, uses_anonymous_args = 0
  78              	.LVL1:
  79 0000 08B5     		push	{r3, lr}
  80              	.LCFI1:
  81              		.cfi_def_cfa_offset 8
  82              		.cfi_offset 3, -8
  83              		.cfi_offset 14, -4
 424:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = startingSector;
  84              		.loc 1 424 0
  85 0002 0A4B     		ldr	r3, .L9
  86 0004 3222     		movs	r2, #50
  87 0006 1A60     		str	r2, [r3]
 425:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = endingSector;
  88              		.loc 1 425 0
  89 0008 5860     		str	r0, [r3, #4]
 426:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
  90              		.loc 1 426 0
  91 000a 9960     		str	r1, [r3, #8]
 427:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
  92              		.loc 1 427 0
  93 000c FFF7FEFF 		bl	iap_Call
  94              	.LVL2:
 433:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_BUSY;
  95              		.loc 1 433 0
  96 0010 074B     		ldr	r3, .L9+4
  97 0012 1B68     		ldr	r3, [r3]
  98 0014 0B2B     		cmp	r3, #11
  99 0016 05D0     		beq	.L6
 435:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_SECTOR_INVALID;
 100              		.loc 1 435 0
 101 0018 072B     		cmp	r3, #7
 438:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 102              		.loc 1 438 0
 103 001a 0CBF     		ite	eq
 104 001c 6FF05900 		mvneq	r0, #89
 105 0020 0120     		movne	r0, #1
 106 0022 08BD     		pop	{r3, pc}
 107              	.L6:
 434:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_INVALID_SECTOR)
 108              		.loc 1 434 0
 109 0024 6FF06600 		mvn	r0, #102
 439:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 110              		.loc 1 439 0
 111 0028 08BD     		pop	{r3, pc}
 112              	.L10:
 113 002a 00BF     		.align	2
 114              	.L9:
 115 002c 00000000 		.word	.LANCHOR1
 116 0030 00000000 		.word	.LANCHOR0
 117              		.cfi_endproc
 118              	.LFE3:
 120              		.section	.text.iap_CopyRAMtoFLASH,"ax",%progbits
 121              		.align	1
 122              		.global	iap_CopyRAMtoFLASH
 123              		.thumb
 124              		.thumb_func
 126              	iap_CopyRAMtoFLASH:
 127              	.LFB4:
 462:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_COPYRAMTOFLASH;
 128              		.loc 1 462 0
 129              		.cfi_startproc
 130              		@ args = 0, pretend = 0, frame = 0
 131              		@ frame_needed = 0, uses_anonymous_args = 0
 132              	.LVL3:
 463:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = address;
 133              		.loc 1 463 0
 134 0000 184B     		ldr	r3, .L20
 462:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_COPYRAMTOFLASH;
 135              		.loc 1 462 0
 136 0002 10B5     		push	{r4, lr}
 137              	.LCFI2:
 138              		.cfi_def_cfa_offset 8
 139              		.cfi_offset 4, -8
 140              		.cfi_offset 14, -4
 466:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [4] = CCLK/1000;
 141              		.loc 1 466 0
 142 0004 DA60     		str	r2, [r3, #12]
 467:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 143              		.loc 1 467 0
 144 0006 184A     		ldr	r2, .L20+4
 145              	.LVL4:
 463:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = address;
 146              		.loc 1 463 0
 147 0008 3324     		movs	r4, #51
 148 000a 1C60     		str	r4, [r3]
 464:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = (u32)buffer;
 149              		.loc 1 464 0
 150 000c 5860     		str	r0, [r3, #4]
 465:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [3] = (u32)bufferLen;
 151              		.loc 1 465 0
 152 000e 9960     		str	r1, [r3, #8]
 467:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 153              		.loc 1 467 0
 154 0010 1A61     		str	r2, [r3, #16]
 468:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 155              		.loc 1 468 0
 156 0012 FFF7FEFF 		bl	iap_Call
 157              	.LVL5:
 470:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_BUSY;
 158              		.loc 1 470 0
 159 0016 154B     		ldr	r3, .L20+8
 160 0018 1B68     		ldr	r3, [r3]
 161 001a 0B2B     		cmp	r3, #11
 162 001c 0FD0     		beq	.L13
 472:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_NOT_PREPARED;
 163              		.loc 1 472 0
 164 001e 092B     		cmp	r3, #9
 165 0020 10D0     		beq	.L14
 474:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR;
 166              		.loc 1 474 0
 167 0022 022B     		cmp	r3, #2
 168 0024 11D0     		beq	.L15
 476:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR;
 169              		.loc 1 476 0
 170 0026 032B     		cmp	r3, #3
 171 0028 12D0     		beq	.L16
 478:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR_NOT_MAPPED;
 172              		.loc 1 478 0
 173 002a 042B     		cmp	r3, #4
 174 002c 13D0     		beq	.L17
 480:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR_NOT_MAPPED;
 175              		.loc 1 480 0
 176 002e 052B     		cmp	r3, #5
 177 0030 14D0     		beq	.L18
 482:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_COUNT;
 178              		.loc 1 482 0
 179 0032 062B     		cmp	r3, #6
 485:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 180              		.loc 1 485 0
 181 0034 0CBF     		ite	eq
 182 0036 6FF06200 		mvneq	r0, #98
 183 003a 0120     		movne	r0, #1
 184 003c 10BD     		pop	{r4, pc}
 185              	.L13:
 471:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SECTOR_NOT_PREPARED)
 186              		.loc 1 471 0
 187 003e 6FF06600 		mvn	r0, #102
 188 0042 10BD     		pop	{r4, pc}
 189              	.L14:
 473:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_ERROR)
 190              		.loc 1 473 0
 191 0044 6FF06400 		mvn	r0, #100
 192 0048 10BD     		pop	{r4, pc}
 193              	.L15:
 475:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_ERROR)
 194              		.loc 1 475 0
 195 004a 6FF05E00 		mvn	r0, #94
 196 004e 10BD     		pop	{r4, pc}
 197              	.L16:
 477:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_NOT_MAPPED)
 198              		.loc 1 477 0
 199 0050 6FF05F00 		mvn	r0, #95
 200 0054 10BD     		pop	{r4, pc}
 201              	.L17:
 479:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_NOT_MAPPED)
 202              		.loc 1 479 0
 203 0056 6FF06000 		mvn	r0, #96
 204 005a 10BD     		pop	{r4, pc}
 205              	.L18:
 481:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_COUNT_ERROR)
 206              		.loc 1 481 0
 207 005c 6FF06100 		mvn	r0, #97
 486:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 208              		.loc 1 486 0
 209 0060 10BD     		pop	{r4, pc}
 210              	.L21:
 211 0062 00BF     		.align	2
 212              	.L20:
 213 0064 00000000 		.word	.LANCHOR1
 214 0068 A0860100 		.word	100000
 215 006c 00000000 		.word	.LANCHOR0
 216              		.cfi_endproc
 217              	.LFE4:
 219              		.section	.text.iap_EraseSectors,"ax",%progbits
 220              		.align	1
 221              		.global	iap_EraseSectors
 222              		.thumb
 223              		.thumb_func
 225              	iap_EraseSectors:
 226              	.LFB5:
 499:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 227              		.loc 1 499 0
 228              		.cfi_startproc
 229              		@ args = 0, pretend = 0, frame = 0
 230              		@ frame_needed = 0, uses_anonymous_args = 0
 231              	.LVL6:
 504:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_PARAM_INVALID;
 232              		.loc 1 504 0
 233 0000 8142     		cmp	r1, r0
 499:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 234              		.loc 1 499 0
 235 0002 08B5     		push	{r3, lr}
 236              	.LCFI3:
 237              		.cfi_def_cfa_offset 8
 238              		.cfi_offset 3, -8
 239              		.cfi_offset 14, -4
 504:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_PARAM_INVALID;
 240              		.loc 1 504 0
 241 0004 14D3     		bcc	.L24
 508:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = startingSector;
 242              		.loc 1 508 0
 243 0006 0F4B     		ldr	r3, .L28
 244 0008 3422     		movs	r2, #52
 245 000a 1A60     		str	r2, [r3]
 511:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 246              		.loc 1 511 0
 247 000c 0E4A     		ldr	r2, .L28+4
 509:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = endingSector;
 248              		.loc 1 509 0
 249 000e 5860     		str	r0, [r3, #4]
 510:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [3] = CCLK/1000;
 250              		.loc 1 510 0
 251 0010 9960     		str	r1, [r3, #8]
 511:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 252              		.loc 1 511 0
 253 0012 DA60     		str	r2, [r3, #12]
 512:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 254              		.loc 1 512 0
 255 0014 FFF7FEFF 		bl	iap_Call
 256              	.LVL7:
 518:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_BUSY;
 257              		.loc 1 518 0
 258 0018 0C4B     		ldr	r3, .L28+8
 259 001a 1B68     		ldr	r3, [r3]
 260 001c 0B2B     		cmp	r3, #11
 261 001e 0AD0     		beq	.L25
 520:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_SECTOR_NOT_PREPARED;
 262              		.loc 1 520 0
 263 0020 092B     		cmp	r3, #9
 264 0022 0BD0     		beq	.L26
 522:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return  errIAP_SECTOR_INVALID;
 265              		.loc 1 522 0
 266 0024 072B     		cmp	r3, #7
 525:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 267              		.loc 1 525 0
 268 0026 0CBF     		ite	eq
 269 0028 6FF05900 		mvneq	r0, #89
 270 002c 0120     		movne	r0, #1
 271 002e 08BD     		pop	{r3, pc}
 272              	.LVL8:
 273              	.L24:
 505:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 274              		.loc 1 505 0
 275 0030 6FF06900 		mvn	r0, #105
 276              	.LVL9:
 277 0034 08BD     		pop	{r3, pc}
 278              	.LVL10:
 279              	.L25:
 519:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SECTOR_NOT_PREPARED)
 280              		.loc 1 519 0
 281 0036 6FF06600 		mvn	r0, #102
 282 003a 08BD     		pop	{r3, pc}
 283              	.L26:
 521:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_INVALID_SECTOR)
 284              		.loc 1 521 0
 285 003c 6FF06400 		mvn	r0, #100
 526:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 286              		.loc 1 526 0
 287 0040 08BD     		pop	{r3, pc}
 288              	.L29:
 289 0042 00BF     		.align	2
 290              	.L28:
 291 0044 00000000 		.word	.LANCHOR1
 292 0048 A0860100 		.word	100000
 293 004c 00000000 		.word	.LANCHOR0
 294              		.cfi_endproc
 295              	.LFE5:
 297              		.section	.text.iap_ClearSectors,"ax",%progbits
 298              		.align	1
 299              		.global	iap_ClearSectors
 300              		.thumb
 301              		.thumb_func
 303              	iap_ClearSectors:
 304              	.LFB0:
 174:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 305              		.loc 1 174 0
 306              		.cfi_startproc
 307              		@ args = 0, pretend = 0, frame = 0
 308              		@ frame_needed = 0, uses_anonymous_args = 0
 309              	.LVL11:
 310 0000 38B5     		push	{r3, r4, r5, lr}
 311              	.LCFI4:
 312              		.cfi_def_cfa_offset 16
 313              		.cfi_offset 3, -16
 314              		.cfi_offset 4, -12
 315              		.cfi_offset 5, -8
 316              		.cfi_offset 14, -4
 174:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 317              		.loc 1 174 0
 318 0002 0446     		mov	r4, r0
 319 0004 0D46     		mov	r5, r1
 186:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 320              		.loc 1 186 0
 321              		.syntax unified
 322              	@ 186 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
 323 0006 72B6     		cpsid i
 324              	@ 0 "" 2
 199:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		goto end_iap_ClearSectors;
 325              		.loc 1 199 0
 326              		.thumb
 327              		.syntax unified
 328 0008 FFF7FEFF 		bl	iap_PrepareSectors
 329              	.LVL12:
 330 000c 0128     		cmp	r0, #1
 331 000e 03D1     		bne	.L31
 203:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 332              		.loc 1 203 0
 333 0010 2946     		mov	r1, r5
 334 0012 2046     		mov	r0, r4
 335              	.LVL13:
 336 0014 FFF7FEFF 		bl	iap_EraseSectors
 337              	.LVL14:
 338              	.L31:
 216:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 339              		.loc 1 216 0
 340              		.syntax unified
 341              	@ 216 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
 342 0018 62B6     		cpsie i
 343              	@ 0 "" 2
 225:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 344              		.loc 1 225 0
 345              		.thumb
 346              		.syntax unified
 347 001a 38BD     		pop	{r3, r4, r5, pc}
 348              		.cfi_endproc
 349              	.LFE0:
 351              		.section	.text.iap_IsSectorsBlank,"ax",%progbits
 352              		.align	1
 353              		.global	iap_IsSectorsBlank
 354              		.thumb
 355              		.thumb_func
 357              	iap_IsSectorsBlank:
 358              	.LFB6:
 537:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_BLANKCHECK;
 359              		.loc 1 537 0
 360              		.cfi_startproc
 361              		@ args = 0, pretend = 0, frame = 0
 362              		@ frame_needed = 0, uses_anonymous_args = 0
 363              	.LVL15:
 364 0000 08B5     		push	{r3, lr}
 365              	.LCFI5:
 366              		.cfi_def_cfa_offset 8
 367              		.cfi_offset 3, -8
 368              		.cfi_offset 14, -4
 538:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = startingSector;
 369              		.loc 1 538 0
 370 0002 0C4B     		ldr	r3, .L37
 371 0004 3522     		movs	r2, #53
 372 0006 1A60     		str	r2, [r3]
 539:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = endingSector;
 373              		.loc 1 539 0
 374 0008 5860     		str	r0, [r3, #4]
 540:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 375              		.loc 1 540 0
 376 000a 9960     		str	r1, [r3, #8]
 541:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 377              		.loc 1 541 0
 378 000c FFF7FEFF 		bl	iap_Call
 379              	.LVL16:
 543:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_BUSY;
 380              		.loc 1 543 0
 381 0010 094B     		ldr	r3, .L37+4
 382 0012 1B68     		ldr	r3, [r3]
 383 0014 0B2B     		cmp	r3, #11
 384 0016 07D0     		beq	.L34
 545:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_NOT_BLANK;
 385              		.loc 1 545 0
 386 0018 082B     		cmp	r3, #8
 387 001a 08D0     		beq	.L35
 547:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_INVALID;
 388              		.loc 1 547 0
 389 001c 072B     		cmp	r3, #7
 550:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 390              		.loc 1 550 0
 391 001e 0CBF     		ite	eq
 392 0020 6FF05900 		mvneq	r0, #89
 393 0024 0120     		movne	r0, #1
 394 0026 08BD     		pop	{r3, pc}
 395              	.L34:
 544:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SECTOR_NOT_BLANK)
 396              		.loc 1 544 0
 397 0028 6FF06600 		mvn	r0, #102
 398 002c 08BD     		pop	{r3, pc}
 399              	.L35:
 546:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_INVALID_SECTOR)
 400              		.loc 1 546 0
 401 002e 6FF06300 		mvn	r0, #99
 551:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 402              		.loc 1 551 0
 403 0032 08BD     		pop	{r3, pc}
 404              	.L38:
 405              		.align	2
 406              	.L37:
 407 0034 00000000 		.word	.LANCHOR1
 408 0038 00000000 		.word	.LANCHOR0
 409              		.cfi_endproc
 410              	.LFE6:
 412              		.section	.text.iap_ReadPartID,"ax",%progbits
 413              		.align	1
 414              		.global	iap_ReadPartID
 415              		.thumb
 416              		.thumb_func
 418              	iap_ReadPartID:
 419              	.LFB7:
 559:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_READPARTID;
 420              		.loc 1 559 0
 421              		.cfi_startproc
 422              		@ args = 0, pretend = 0, frame = 0
 423              		@ frame_needed = 0, uses_anonymous_args = 0
 424 0000 08B5     		push	{r3, lr}
 425              	.LCFI6:
 426              		.cfi_def_cfa_offset 8
 427              		.cfi_offset 3, -8
 428              		.cfi_offset 14, -4
 560:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 429              		.loc 1 560 0
 430 0002 044B     		ldr	r3, .L40
 431 0004 3622     		movs	r2, #54
 432 0006 1A60     		str	r2, [r3]
 561:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return iapResults [1];
 433              		.loc 1 561 0
 434 0008 FFF7FEFF 		bl	iap_Call
 435              	.LVL17:
 563:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 436              		.loc 1 563 0
 437 000c 024B     		ldr	r3, .L40+4
 438 000e 5868     		ldr	r0, [r3, #4]
 439 0010 08BD     		pop	{r3, pc}
 440              	.L41:
 441 0012 00BF     		.align	2
 442              	.L40:
 443 0014 00000000 		.word	.LANCHOR1
 444 0018 00000000 		.word	.LANCHOR0
 445              		.cfi_endproc
 446              	.LFE7:
 448              		.section	.text.iap_ReadBootCodeVersion,"ax",%progbits
 449              		.align	1
 450              		.global	iap_ReadBootCodeVersion
 451              		.thumb
 452              		.thumb_func
 454              	iap_ReadBootCodeVersion:
 455              	.LFB8:
 570:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_READBOOTCODEVER;
 456              		.loc 1 570 0
 457              		.cfi_startproc
 458              		@ args = 0, pretend = 0, frame = 0
 459              		@ frame_needed = 0, uses_anonymous_args = 0
 460 0000 08B5     		push	{r3, lr}
 461              	.LCFI7:
 462              		.cfi_def_cfa_offset 8
 463              		.cfi_offset 3, -8
 464              		.cfi_offset 14, -4
 571:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 465              		.loc 1 571 0
 466 0002 044B     		ldr	r3, .L43
 467 0004 3722     		movs	r2, #55
 468 0006 1A60     		str	r2, [r3]
 572:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return iapResults [1];
 469              		.loc 1 572 0
 470 0008 FFF7FEFF 		bl	iap_Call
 471              	.LVL18:
 574:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 472              		.loc 1 574 0
 473 000c 024B     		ldr	r3, .L43+4
 474 000e 5868     		ldr	r0, [r3, #4]
 475 0010 08BD     		pop	{r3, pc}
 476              	.L44:
 477 0012 00BF     		.align	2
 478              	.L43:
 479 0014 00000000 		.word	.LANCHOR1
 480 0018 00000000 		.word	.LANCHOR0
 481              		.cfi_endproc
 482              	.LFE8:
 484              		.section	.text.iap_Compare,"ax",%progbits
 485              		.align	1
 486              		.global	iap_Compare
 487              		.thumb
 488              		.thumb_func
 490              	iap_Compare:
 491              	.LFB9:
 589:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_COMPARE;
 492              		.loc 1 589 0
 493              		.cfi_startproc
 494              		@ args = 0, pretend = 0, frame = 0
 495              		@ frame_needed = 0, uses_anonymous_args = 0
 496              	.LVL19:
 590:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = address;
 497              		.loc 1 590 0
 498 0000 144B     		ldr	r3, .L53
 589:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [0] = IAP_CMD_COMPARE;
 499              		.loc 1 589 0
 500 0002 10B5     		push	{r4, lr}
 501              	.LCFI8:
 502              		.cfi_def_cfa_offset 8
 503              		.cfi_offset 4, -8
 504              		.cfi_offset 14, -4
 590:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [1] = address;
 505              		.loc 1 590 0
 506 0004 3824     		movs	r4, #56
 507 0006 1C60     		str	r4, [r3]
 591:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [2] = (u32) buffer;
 508              		.loc 1 591 0
 509 0008 5860     		str	r0, [r3, #4]
 592:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iapCommands [3] = bufferLen;
 510              		.loc 1 592 0
 511 000a 9960     		str	r1, [r3, #8]
 593:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	iap_Call ();
 512              		.loc 1 593 0
 513 000c DA60     		str	r2, [r3, #12]
 594:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 514              		.loc 1 594 0
 515 000e FFF7FEFF 		bl	iap_Call
 516              	.LVL20:
 596:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_COMPARE;
 517              		.loc 1 596 0
 518 0012 114B     		ldr	r3, .L53+4
 519 0014 1B68     		ldr	r3, [r3]
 520 0016 0A2B     		cmp	r3, #10
 521 0018 0DD0     		beq	.L47
 598:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_COUNT;
 522              		.loc 1 598 0
 523 001a 062B     		cmp	r3, #6
 524 001c 0ED0     		beq	.L48
 600:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR;
 525              		.loc 1 600 0
 526 001e 022B     		cmp	r3, #2
 527 0020 0FD0     		beq	.L49
 602:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR;
 528              		.loc 1 602 0
 529 0022 032B     		cmp	r3, #3
 530 0024 10D0     		beq	.L50
 604:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SRC_ADDR_NOT_MAPPED;
 531              		.loc 1 604 0
 532 0026 042B     		cmp	r3, #4
 533 0028 11D0     		beq	.L51
 606:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_DST_ADDR_NOT_MAPPED;
 534              		.loc 1 606 0
 535 002a 052B     		cmp	r3, #5
 609:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 536              		.loc 1 609 0
 537 002c 0CBF     		ite	eq
 538 002e 6FF06100 		mvneq	r0, #97
 539 0032 0120     		movne	r0, #1
 540 0034 10BD     		pop	{r4, pc}
 541              	.L47:
 597:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_COUNT_ERROR)
 542              		.loc 1 597 0
 543 0036 6FF06500 		mvn	r0, #101
 544 003a 10BD     		pop	{r4, pc}
 545              	.L48:
 599:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_ERROR)
 546              		.loc 1 599 0
 547 003c 6FF06200 		mvn	r0, #98
 548 0040 10BD     		pop	{r4, pc}
 549              	.L49:
 601:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_ERROR)
 550              		.loc 1 601 0
 551 0042 6FF05E00 		mvn	r0, #94
 552 0046 10BD     		pop	{r4, pc}
 553              	.L50:
 603:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_SRC_ADDR_NOT_MAPPED)
 554              		.loc 1 603 0
 555 0048 6FF05F00 		mvn	r0, #95
 556 004c 10BD     		pop	{r4, pc}
 557              	.L51:
 605:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	else if (iapResults [0] == IAP_RESULT_DST_ADDR_NOT_MAPPED)
 558              		.loc 1 605 0
 559 004e 6FF06000 		mvn	r0, #96
 610:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 560              		.loc 1 610 0
 561 0052 10BD     		pop	{r4, pc}
 562              	.L54:
 563              		.align	2
 564              	.L53:
 565 0054 00000000 		.word	.LANCHOR1
 566 0058 00000000 		.word	.LANCHOR0
 567              		.cfi_endproc
 568              	.LFE9:
 570              		.section	.text.iap_FillSectors,"ax",%progbits
 571              		.align	1
 572              		.global	iap_FillSectors
 573              		.thumb
 574              		.thumb_func
 576              	iap_FillSectors:
 577              	.LFB2:
 335:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 578              		.loc 1 335 0
 579              		.cfi_startproc
 580              		@ args = 0, pretend = 0, frame = 256
 581              		@ frame_needed = 0, uses_anonymous_args = 0
 582              	.LVL21:
 583 0000 2DE9F047 		push	{r4, r5, r6, r7, r8, r9, r10, lr}
 584              	.LCFI9:
 585              		.cfi_def_cfa_offset 32
 586              		.cfi_offset 4, -32
 587              		.cfi_offset 5, -28
 588              		.cfi_offset 6, -24
 589              		.cfi_offset 7, -20
 590              		.cfi_offset 8, -16
 591              		.cfi_offset 9, -12
 592              		.cfi_offset 10, -8
 593              		.cfi_offset 14, -4
 594 0004 0E46     		mov	r6, r1
 346:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_PARAM_INVALID;
 595              		.loc 1 346 0
 596 0006 8642     		cmp	r6, r0
 335:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 597              		.loc 1 335 0
 598 0008 C0B0     		sub	sp, sp, #256
 599              	.LCFI10:
 600              		.cfi_def_cfa_offset 288
 335:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 601              		.loc 1 335 0
 602 000a 0446     		mov	r4, r0
 603 000c 1146     		mov	r1, r2
 604              	.LVL22:
 346:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_PARAM_INVALID;
 605              		.loc 1 346 0
 606 000e 33D3     		bcc	.L63
 349:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	result = pdPASS;
 607              		.loc 1 349 0
 608 0010 4FF48072 		mov	r2, #256
 609              	.LVL23:
 610 0014 6846     		mov	r0, sp
 611              	.LVL24:
 612 0016 FFF7FEFF 		bl	memset
 613              	.LVL25:
 351:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 614              		.loc 1 351 0
 615              		.syntax unified
 616              	@ 351 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
 617 001a 72B6     		cpsid i
 618              	@ 0 "" 2
 619              	.LVL26:
 620              		.thumb
 621              		.syntax unified
 622              	.LBB5:
 623              	.LBB6:
 624              	.LBB7:
 725:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	if (sectorSize)
 625              		.loc 1 725 0
 626 001c 1B4F     		ldr	r7, .L69
 627              	.LVL27:
 628              	.L61:
 721:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	return errIAP_SECTOR_INVALID;
 629              		.loc 1 721 0
 630 001e 0F2C     		cmp	r4, #15
 631 0020 2DD8     		bhi	.L64
 727:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 632              		.loc 1 727 0
 633 0022 07EBC403 		add	r3, r7, r4, lsl #3
 725:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	if (sectorSize)
 634              		.loc 1 725 0
 635 0026 57F83490 		ldr	r9, [r7, r4, lsl #3]
 636              	.LVL28:
 727:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 637              		.loc 1 727 0
 638 002a B3F80480 		ldrh	r8, [r3, #4]
 639              	.LVL29:
 640 002e 0025     		movs	r5, #0
 641              	.L58:
 642              	.LVL30:
 643              	.LBE7:
 644              	.LBE6:
 373:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 645              		.loc 1 373 0 discriminator 1
 646 0030 4545     		cmp	r5, r8
 647 0032 1BD2     		bcs	.L68
 376:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 				break;
 648              		.loc 1 376 0
 649 0034 2146     		mov	r1, r4
 650 0036 2046     		mov	r0, r4
 651 0038 FFF7FEFF 		bl	iap_PrepareSectors
 652              	.LVL31:
 653 003c 0128     		cmp	r0, #1
 654 003e 19D1     		bne	.L62
 380:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 				break;
 655              		.loc 1 380 0
 656 0040 05EB090A 		add	r10, r5, r9
 657 0044 4FF48072 		mov	r2, #256
 658 0048 6946     		mov	r1, sp
 659 004a 5046     		mov	r0, r10
 660              	.LVL32:
 661 004c FFF7FEFF 		bl	iap_CopyRAMtoFLASH
 662              	.LVL33:
 663 0050 0128     		cmp	r0, #1
 664 0052 0FD1     		bne	.L62
 385:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 				break;
 665              		.loc 1 385 0
 666 0054 4FF48072 		mov	r2, #256
 667 0058 6946     		mov	r1, sp
 668 005a 5046     		mov	r0, r10
 669              	.LVL34:
 670 005c FFF7FEFF 		bl	iap_Compare
 671              	.LVL35:
 672 0060 0128     		cmp	r0, #1
 673 0062 07D1     		bne	.L62
 373:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 674              		.loc 1 373 0 discriminator 2
 675 0064 05F58075 		add	r5, r5, #256
 676              	.LVL36:
 677 0068 ADB2     		uxth	r5, r5
 678              	.LVL37:
 679 006a E1E7     		b	.L58
 680              	.LVL38:
 681              	.L68:
 682              	.LBE5:
 353:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		u16 i;
 683              		.loc 1 353 0
 684 006c 0134     		adds	r4, r4, #1
 685              	.LVL39:
 686 006e A642     		cmp	r6, r4
 687 0070 D5D2     		bcs	.L61
 688 0072 0120     		movs	r0, #1
 689              	.LVL40:
 690              	.L62:
 404:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	return result;
 691              		.loc 1 404 0
 692              		.syntax unified
 693              	@ 404 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
 694 0074 62B6     		cpsie i
 695              	@ 0 "" 2
 405:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 696              		.loc 1 405 0
 697              		.thumb
 698              		.syntax unified
 699 0076 05E0     		b	.L67
 700              	.LVL41:
 701              	.L63:
 347:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 702              		.loc 1 347 0
 703 0078 6FF06900 		mvn	r0, #105
 704              	.LVL42:
 705 007c 02E0     		b	.L67
 706              	.LVL43:
 707              	.L64:
 708              	.LBB10:
 709              	.LBB9:
 710              	.LBB8:
 722:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 711              		.loc 1 722 0
 712 007e 6FF05900 		mvn	r0, #89
 713              	.LVL44:
 714 0082 F7E7     		b	.L62
 715              	.LVL45:
 716              	.L67:
 717              	.LBE8:
 718              	.LBE9:
 719              	.LBE10:
 406:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 720              		.loc 1 406 0
 721 0084 40B0     		add	sp, sp, #256
 722              	.LCFI11:
 723              		.cfi_def_cfa_offset 32
 724              		@ sp needed
 725 0086 BDE8F087 		pop	{r4, r5, r6, r7, r8, r9, r10, pc}
 726              	.LVL46:
 727              	.L70:
 728 008a 00BF     		.align	2
 729              	.L69:
 730 008c 00000000 		.word	.LANCHOR2
 731              		.cfi_endproc
 732              	.LFE2:
 734              		.section	.text.iap_IsValidSector,"ax",%progbits
 735              		.align	1
 736              		.global	iap_IsValidSector
 737              		.thumb
 738              		.thumb_func
 740              	iap_IsValidSector:
 741              	.LFB11:
 681:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	if ((sector >= (u32) arrsizeof (flashSectorToAddress))) {
 742              		.loc 1 681 0
 743              		.cfi_startproc
 744              		@ args = 0, pretend = 0, frame = 0
 745              		@ frame_needed = 0, uses_anonymous_args = 0
 746              		@ link register save eliminated.
 747              	.LVL47:
 682:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SECTOR_INVALID;
 748              		.loc 1 682 0
 749 0000 0F28     		cmp	r0, #15
 687:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 750              		.loc 1 687 0
 751 0002 8CBF     		ite	hi
 752 0004 6FF05900 		mvnhi	r0, #89
 753              	.LVL48:
 754 0008 0120     		movls	r0, #1
 755 000a 7047     		bx	lr
 756              		.cfi_endproc
 757              	.LFE11:
 759              		.section	.text.iap_AddressToSector,"ax",%progbits
 760              		.align	1
 761              		.global	iap_AddressToSector
 762              		.thumb
 763              		.thumb_func
 765              	iap_AddressToSector:
 766              	.LFB12:
 696:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	u32 i;
 767              		.loc 1 696 0
 768              		.cfi_startproc
 769              		@ args = 0, pretend = 0, frame = 0
 770              		@ frame_needed = 0, uses_anonymous_args = 0
 771              	.LVL49:
 772 0000 30B5     		push	{r4, r5, lr}
 773              	.LCFI12:
 774              		.cfi_def_cfa_offset 12
 775              		.cfi_offset 4, -12
 776              		.cfi_offset 5, -8
 777              		.cfi_offset 14, -4
 700:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     		*sector = i;
 778              		.loc 1 700 0
 779 0002 094C     		ldr	r4, .L79
 699:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	if (address < (flashSectorToAddress [i].address + flashSectorToAddress [i].sizeInBytes)) {
 780              		.loc 1 699 0
 781 0004 0023     		movs	r3, #0
 782              	.LVL50:
 783              	.L77:
 700:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     		*sector = i;
 784              		.loc 1 700 0
 785 0006 04EBC302 		add	r2, r4, r3, lsl #3
 786 000a 9588     		ldrh	r5, [r2, #4]
 787 000c 54F83320 		ldr	r2, [r4, r3, lsl #3]
 788 0010 2A44     		add	r2, r2, r5
 789 0012 8242     		cmp	r2, r0
 790 0014 02D9     		bls	.L75
 701:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 			#if (IAP_USE_DEBUG == pdON)
 791              		.loc 1 701 0
 792 0016 0B60     		str	r3, [r1]
 706:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	}
 793              		.loc 1 706 0
 794 0018 0120     		movs	r0, #1
 795              	.LVL51:
 796 001a 30BD     		pop	{r4, r5, pc}
 797              	.LVL52:
 798              	.L75:
 699:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	if (address < (flashSectorToAddress [i].address + flashSectorToAddress [i].sizeInBytes)) {
 799              		.loc 1 699 0 discriminator 2
 800 001c 0133     		adds	r3, r3, #1
 801              	.LVL53:
 802 001e 102B     		cmp	r3, #16
 803 0020 F1D1     		bne	.L77
 709:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 804              		.loc 1 709 0
 805 0022 6FF05900 		mvn	r0, #89
 806              	.LVL54:
 710:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 807              		.loc 1 710 0
 808 0026 30BD     		pop	{r4, r5, pc}
 809              	.L80:
 810              		.align	2
 811              	.L79:
 812 0028 00000000 		.word	.LANCHOR2
 813              		.cfi_endproc
 814              	.LFE12:
 816              		.section	.text.iap_WriteSectors,"ax",%progbits
 817              		.align	1
 818              		.global	iap_WriteSectors
 819              		.thumb
 820              		.thumb_func
 822              	iap_WriteSectors:
 823              	.LFB1:
 247:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 824              		.loc 1 247 0
 825              		.cfi_startproc
 826              		@ args = 0, pretend = 0, frame = 8
 827              		@ frame_needed = 0, uses_anonymous_args = 0
 828              	.LVL55:
 257:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SIZE_INVALID;
 829              		.loc 1 257 0
 830 0000 B2F5807F 		cmp	r2, #256
 247:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 831              		.loc 1 247 0
 832 0004 73B5     		push	{r0, r1, r4, r5, r6, lr}
 833              	.LCFI13:
 834              		.cfi_def_cfa_offset 24
 835              		.cfi_offset 4, -16
 836              		.cfi_offset 5, -12
 837              		.cfi_offset 6, -8
 838              		.cfi_offset 14, -4
 247:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 839              		.loc 1 247 0
 840 0006 0546     		mov	r5, r0
 841 0008 0E46     		mov	r6, r1
 842 000a 1446     		mov	r4, r2
 257:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SIZE_INVALID;
 843              		.loc 1 257 0
 844 000c 08D0     		beq	.L82
 257:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SIZE_INVALID;
 845              		.loc 1 257 0 is_stmt 0 discriminator 1
 846 000e B2F5007F 		cmp	r2, #512
 847 0012 05D0     		beq	.L82
 257:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SIZE_INVALID;
 848              		.loc 1 257 0 discriminator 2
 849 0014 B2F5806F 		cmp	r2, #1024
 850 0018 02D0     		beq	.L82
 257:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_SIZE_INVALID;
 851              		.loc 1 257 0 discriminator 3
 852 001a B2F5805F 		cmp	r2, #4096
 853 001e 1AD1     		bne	.L85
 854              	.L82:
 262:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return result;
 855              		.loc 1 262 0 is_stmt 1
 856 0020 01A9     		add	r1, sp, #4
 857              	.LVL56:
 858 0022 2846     		mov	r0, r5
 859              	.LVL57:
 860 0024 FFF7FEFF 		bl	iap_AddressToSector
 861              	.LVL58:
 862 0028 0128     		cmp	r0, #1
 863 002a 16D1     		bne	.L83
 269:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 864              		.loc 1 269 0
 865              		.syntax unified
 866              	@ 269 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
 867 002c 72B6     		cpsid i
 868              	@ 0 "" 2
 283:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		goto end_iap_WriteSectors;
 869              		.loc 1 283 0
 870              		.thumb
 871              		.syntax unified
 872 002e 0199     		ldr	r1, [sp, #4]
 873 0030 0846     		mov	r0, r1
 874              	.LVL59:
 875 0032 FFF7FEFF 		bl	iap_PrepareSectors
 876              	.LVL60:
 877 0036 0128     		cmp	r0, #1
 878 0038 0BD1     		bne	.L84
 288:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		goto end_iap_WriteSectors;
 879              		.loc 1 288 0
 880 003a 2246     		mov	r2, r4
 881 003c 3146     		mov	r1, r6
 882 003e 2846     		mov	r0, r5
 883              	.LVL61:
 884 0040 FFF7FEFF 		bl	iap_CopyRAMtoFLASH
 885              	.LVL62:
 886 0044 0128     		cmp	r0, #1
 887 0046 04D1     		bne	.L84
 297:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 888              		.loc 1 297 0
 889 0048 2246     		mov	r2, r4
 890 004a 3146     		mov	r1, r6
 891 004c 2846     		mov	r0, r5
 892              	.LVL63:
 893 004e FFF7FEFF 		bl	iap_Compare
 894              	.LVL64:
 895              	.L84:
 306:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 896              		.loc 1 306 0
 897              		.syntax unified
 898              	@ 306 "uc_libc_dev/_arch/arm_lpc/flash/iap.c" 1
 899 0052 62B6     		cpsie i
 900              	@ 0 "" 2
 312:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 901              		.loc 1 312 0
 902              		.thumb
 903              		.syntax unified
 904 0054 01E0     		b	.L83
 905              	.LVL65:
 906              	.L85:
 258:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 907              		.loc 1 258 0
 908 0056 6FF06800 		mvn	r0, #104
 909              	.LVL66:
 910              	.L83:
 313:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 911              		.loc 1 313 0
 912 005a 02B0     		add	sp, sp, #8
 913              	.LCFI14:
 914              		.cfi_def_cfa_offset 16
 915              		@ sp needed
 916 005c 70BD     		pop	{r4, r5, r6, pc}
 917              		.cfi_endproc
 918              	.LFE1:
 920              		.section	.text.iap_IsSafeSector,"ax",%progbits
 921              		.align	1
 922              		.global	iap_IsSafeSector
 923              		.thumb
 924              		.thumb_func
 926              	iap_IsSafeSector:
 927              	.LFB10:
 657:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 928              		.loc 1 657 0
 929              		.cfi_startproc
 930              		@ args = 0, pretend = 0, frame = 8
 931              		@ frame_needed = 0, uses_anonymous_args = 0
 932              	.LVL67:
 933 0000 13B5     		push	{r0, r1, r4, lr}
 934              	.LCFI15:
 935              		.cfi_def_cfa_offset 16
 936              		.cfi_offset 4, -8
 937              		.cfi_offset 14, -4
 663:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return result;
 938              		.loc 1 663 0
 939 0002 0D4B     		ldr	r3, .L102
 657:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 	int result;
 940              		.loc 1 657 0
 941 0004 0446     		mov	r4, r0
 663:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return result;
 942              		.loc 1 663 0
 943 0006 6946     		mov	r1, sp
 944 0008 1868     		ldr	r0, [r3]
 945              	.LVL68:
 946 000a FFF7FEFF 		bl	iap_AddressToSector
 947              	.LVL69:
 948 000e 0128     		cmp	r0, #1
 949 0010 0FD1     		bne	.L97
 666:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return result;
 950              		.loc 1 666 0
 951 0012 0A4B     		ldr	r3, .L102+4
 952 0014 01A9     		add	r1, sp, #4
 953 0016 1868     		ldr	r0, [r3]
 954              	.LVL70:
 955 0018 FFF7FEFF 		bl	iap_AddressToSector
 956              	.LVL71:
 957 001c 0128     		cmp	r0, #1
 958 001e 08D1     		bne	.L97
 669:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_NO_SAFE_REGION;
 959              		.loc 1 669 0
 960 0020 009B     		ldr	r3, [sp]
 961 0022 A342     		cmp	r3, r4
 962 0024 05D8     		bhi	.L97
 669:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 		return errIAP_NO_SAFE_REGION;
 963              		.loc 1 669 0 is_stmt 0 discriminator 1
 964 0026 019B     		ldr	r3, [sp, #4]
 965 0028 9C42     		cmp	r4, r3
 670:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 966              		.loc 1 670 0 is_stmt 1 discriminator 1
 967 002a 8CBF     		ite	hi
 968 002c 0120     		movhi	r0, #1
 969              	.LVL72:
 970 002e 6FF06A00 		mvnls	r0, #106
 971              	.L97:
 673:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 972              		.loc 1 673 0
 973 0032 02B0     		add	sp, sp, #8
 974              	.LCFI16:
 975              		.cfi_def_cfa_offset 8
 976              		@ sp needed
 977 0034 10BD     		pop	{r4, pc}
 978              	.LVL73:
 979              	.L103:
 980 0036 00BF     		.align	2
 981              	.L102:
 982 0038 00000000 		.word	.LANCHOR3
 983 003c 00000000 		.word	.LANCHOR4
 984              		.cfi_endproc
 985              	.LFE10:
 987              		.section	.text.iap_SectorToAddress,"ax",%progbits
 988              		.align	1
 989              		.global	iap_SectorToAddress
 990              		.thumb
 991              		.thumb_func
 993              	iap_SectorToAddress:
 994              	.LFB13:
 720:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	if (sectorNumber >= (u32) arrsizeof (flashSectorToAddress))
 995              		.loc 1 720 0
 996              		.cfi_startproc
 997              		@ args = 0, pretend = 0, frame = 0
 998              		@ frame_needed = 0, uses_anonymous_args = 0
 999              		@ link register save eliminated.
 1000              	.LVL74:
 721:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	return errIAP_SECTOR_INVALID;
 1001              		.loc 1 721 0
 1002 0000 0F28     		cmp	r0, #15
 1003 0002 0BD8     		bhi	.L107
 724:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	*address = flashSectorToAddress [sectorNumber].address;
 1004              		.loc 1 724 0
 1005 0004 19B1     		cbz	r1, .L106
 725:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****   	if (sectorSize)
 1006              		.loc 1 725 0
 1007 0006 084B     		ldr	r3, .L112
 1008 0008 53F83030 		ldr	r3, [r3, r0, lsl #3]
 1009 000c 0B60     		str	r3, [r1]
 1010              	.L106:
 726:uc_libc_dev/_arch/arm_lpc/flash/iap.c ****     	*sectorSize = flashSectorToAddress [sectorNumber].sizeInBytes;
 1011              		.loc 1 726 0
 1012 000e 42B1     		cbz	r2, .L108
 727:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 1013              		.loc 1 727 0
 1014 0010 054B     		ldr	r3, .L112
 1015 0012 03EBC000 		add	r0, r3, r0, lsl #3
 1016              	.LVL75:
 1017 0016 8388     		ldrh	r3, [r0, #4]
 1018 0018 1360     		str	r3, [r2]
 1019 001a 02E0     		b	.L108
 1020              	.LVL76:
 1021              	.L107:
 722:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 1022              		.loc 1 722 0
 1023 001c 6FF05900 		mvn	r0, #89
 1024              	.LVL77:
 1025 0020 7047     		bx	lr
 1026              	.L108:
 733:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** }
 1027              		.loc 1 733 0
 1028 0022 0120     		movs	r0, #1
 734:uc_libc_dev/_arch/arm_lpc/flash/iap.c **** 
 1029              		.loc 1 734 0
 1030 0024 7047     		bx	lr
 1031              	.L113:
 1032 0026 00BF     		.align	2
 1033              	.L112:
 1034 0028 00000000 		.word	.LANCHOR2
 1035              		.cfi_endproc
 1036              	.LFE13:
 1038              		.global	flashSectorToAddress
 1039              		.section	.rodata.init_of_text,"a",%progbits
 1040              		.align	2
 1041              		.set	.LANCHOR3,. + 0
 1044              	init_of_text:
 1045 0000 00000000 		.word	_itext
 1046              		.section	.rodata.end_of_text,"a",%progbits
 1047              		.align	2
 1048              		.set	.LANCHOR4,. + 0
 1051              	end_of_text:
 1052 0000 00000000 		.word	_etext
 1053              		.section	.bss.iapResults,"aw",%nobits
 1054              		.align	2
 1055              		.set	.LANCHOR0,. + 0
 1058              	iapResults:
 1059 0000 00000000 		.space	12
 1059      00000000 
 1059      00000000 
 1060              		.section	.bss.iapCommands,"aw",%nobits
 1061              		.align	2
 1062              		.set	.LANCHOR1,. + 0
 1065              	iapCommands:
 1066 0000 00000000 		.space	20
 1066      00000000 
 1066      00000000 
 1066      00000000 
 1066      00000000 
 1067              		.section	.data.flashSectorToAddress,"aw",%progbits
 1068              		.align	2
 1069              		.set	.LANCHOR2,. + 0
 1072              	flashSectorToAddress:
 1073 0000 00000000 		.word	0
 1074 0004 0010     		.short	4096
 1075 0006 0000     		.space	2
 1076 0008 00100000 		.word	4096
 1077 000c 0010     		.short	4096
 1078 000e 0000     		.space	2
 1079 0010 00200000 		.word	8192
 1080 0014 0010     		.short	4096
 1081 0016 0000     		.space	2
 1082 0018 00300000 		.word	12288
 1083 001c 0010     		.short	4096
 1084 001e 0000     		.space	2
 1085 0020 00400000 		.word	16384
 1086 0024 0010     		.short	4096
 1087 0026 0000     		.space	2
 1088 0028 00500000 		.word	20480
 1089 002c 0010     		.short	4096
 1090 002e 0000     		.space	2
 1091 0030 00600000 		.word	24576
 1092 0034 0010     		.short	4096
 1093 0036 0000     		.space	2
 1094 0038 00700000 		.word	28672
 1095 003c 0010     		.short	4096
 1096 003e 0000     		.space	2
 1097 0040 00800000 		.word	32768
 1098 0044 0010     		.short	4096
 1099 0046 0000     		.space	2
 1100 0048 00900000 		.word	36864
 1101 004c 0010     		.short	4096
 1102 004e 0000     		.space	2
 1103 0050 00A00000 		.word	40960
 1104 0054 0010     		.short	4096
 1105 0056 0000     		.space	2
 1106 0058 00B00000 		.word	45056
 1107 005c 0010     		.short	4096
 1108 005e 0000     		.space	2
 1109 0060 00C00000 		.word	49152
 1110 0064 0010     		.short	4096
 1111 0066 0000     		.space	2
 1112 0068 00D00000 		.word	53248
 1113 006c 0010     		.short	4096
 1114 006e 0000     		.space	2
 1115 0070 00E00000 		.word	57344
 1116 0074 0010     		.short	4096
 1117 0076 0000     		.space	2
 1118 0078 00F00000 		.word	61440
 1119 007c 0010     		.short	4096
 1120 007e 0000     		.space	2
 1121              		.text
 1122              	.Letext0:
 1123              		.file 2 "uc_libc_dev/_libdef/uc_libdefs.h"
 1124              		.file 3 "uc_libc_dev/_arch/arm_lpc/flash/iap.h"
 1125              		.file 4 "d:\\cc\\arm-yagarto-5.4.2016q3\\arm-none-eabi\\include\\string.h"
DEFINED SYMBOLS
                            *ABS*:00000000 iap.c
D:\_temp\_windows\ccO5R8wk.s:20     .text.iap_Call:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:24     .text.iap_Call:00000000 iap_Call
D:\_temp\_windows\ccO5R8wk.s:60     .text.iap_Call:00000010 $d
D:\_temp\_windows\ccO5R8wk.s:67     .text.iap_PrepareSectors:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:72     .text.iap_PrepareSectors:00000000 iap_PrepareSectors
D:\_temp\_windows\ccO5R8wk.s:115    .text.iap_PrepareSectors:0000002c $d
D:\_temp\_windows\ccO5R8wk.s:121    .text.iap_CopyRAMtoFLASH:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:126    .text.iap_CopyRAMtoFLASH:00000000 iap_CopyRAMtoFLASH
D:\_temp\_windows\ccO5R8wk.s:213    .text.iap_CopyRAMtoFLASH:00000064 $d
D:\_temp\_windows\ccO5R8wk.s:220    .text.iap_EraseSectors:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:225    .text.iap_EraseSectors:00000000 iap_EraseSectors
D:\_temp\_windows\ccO5R8wk.s:291    .text.iap_EraseSectors:00000044 $d
D:\_temp\_windows\ccO5R8wk.s:298    .text.iap_ClearSectors:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:303    .text.iap_ClearSectors:00000000 iap_ClearSectors
D:\_temp\_windows\ccO5R8wk.s:352    .text.iap_IsSectorsBlank:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:357    .text.iap_IsSectorsBlank:00000000 iap_IsSectorsBlank
D:\_temp\_windows\ccO5R8wk.s:407    .text.iap_IsSectorsBlank:00000034 $d
D:\_temp\_windows\ccO5R8wk.s:413    .text.iap_ReadPartID:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:418    .text.iap_ReadPartID:00000000 iap_ReadPartID
D:\_temp\_windows\ccO5R8wk.s:443    .text.iap_ReadPartID:00000014 $d
D:\_temp\_windows\ccO5R8wk.s:449    .text.iap_ReadBootCodeVersion:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:454    .text.iap_ReadBootCodeVersion:00000000 iap_ReadBootCodeVersion
D:\_temp\_windows\ccO5R8wk.s:479    .text.iap_ReadBootCodeVersion:00000014 $d
D:\_temp\_windows\ccO5R8wk.s:485    .text.iap_Compare:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:490    .text.iap_Compare:00000000 iap_Compare
D:\_temp\_windows\ccO5R8wk.s:565    .text.iap_Compare:00000054 $d
D:\_temp\_windows\ccO5R8wk.s:571    .text.iap_FillSectors:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:576    .text.iap_FillSectors:00000000 iap_FillSectors
D:\_temp\_windows\ccO5R8wk.s:730    .text.iap_FillSectors:0000008c $d
D:\_temp\_windows\ccO5R8wk.s:735    .text.iap_IsValidSector:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:740    .text.iap_IsValidSector:00000000 iap_IsValidSector
D:\_temp\_windows\ccO5R8wk.s:760    .text.iap_AddressToSector:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:765    .text.iap_AddressToSector:00000000 iap_AddressToSector
D:\_temp\_windows\ccO5R8wk.s:812    .text.iap_AddressToSector:00000028 $d
D:\_temp\_windows\ccO5R8wk.s:817    .text.iap_WriteSectors:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:822    .text.iap_WriteSectors:00000000 iap_WriteSectors
D:\_temp\_windows\ccO5R8wk.s:921    .text.iap_IsSafeSector:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:926    .text.iap_IsSafeSector:00000000 iap_IsSafeSector
D:\_temp\_windows\ccO5R8wk.s:982    .text.iap_IsSafeSector:00000038 $d
D:\_temp\_windows\ccO5R8wk.s:988    .text.iap_SectorToAddress:00000000 $t
D:\_temp\_windows\ccO5R8wk.s:993    .text.iap_SectorToAddress:00000000 iap_SectorToAddress
D:\_temp\_windows\ccO5R8wk.s:1034   .text.iap_SectorToAddress:00000028 $d
D:\_temp\_windows\ccO5R8wk.s:1072   .data.flashSectorToAddress:00000000 flashSectorToAddress
D:\_temp\_windows\ccO5R8wk.s:1040   .rodata.init_of_text:00000000 $d
D:\_temp\_windows\ccO5R8wk.s:1044   .rodata.init_of_text:00000000 init_of_text
D:\_temp\_windows\ccO5R8wk.s:1047   .rodata.end_of_text:00000000 $d
D:\_temp\_windows\ccO5R8wk.s:1051   .rodata.end_of_text:00000000 end_of_text
D:\_temp\_windows\ccO5R8wk.s:1054   .bss.iapResults:00000000 $d
D:\_temp\_windows\ccO5R8wk.s:1058   .bss.iapResults:00000000 iapResults
D:\_temp\_windows\ccO5R8wk.s:1061   .bss.iapCommands:00000000 $d
D:\_temp\_windows\ccO5R8wk.s:1065   .bss.iapCommands:00000000 iapCommands
D:\_temp\_windows\ccO5R8wk.s:1068   .data.flashSectorToAddress:00000000 $d
                     .debug_frame:00000010 $d

UNDEFINED SYMBOLS
memset
_itext
_etext
